home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / console.c < prev    next >
C/C++ Source or Header  |  1991-10-24  |  706b  |  45 lines

  1. /* console I/O routines */
  2. /* written by Eric R. Smith, placed in the public domain */
  3.  
  4. /* BUGS: under TOS, all tty input is assumed to come from the keyboard
  5.  * (unless we can figure out otherwise)
  6.  */
  7.  
  8. #include <osbind.h>
  9. #include <mintbind.h>
  10. #define CTRL(x) (x & 0x1f)
  11.  
  12. extern int __mint;
  13.  
  14. #define CBUFSIZ 80
  15.  
  16. int
  17. _console_read_byte(fd)
  18.     int fd;
  19. {
  20.     short f;
  21.  
  22.     if (__mint) {
  23.         return Fgetchar(fd, 0);
  24.     }
  25.     if (fd == 0)
  26.         return Crawcin();
  27.     if (fd == 2)
  28.         return Cauxin();
  29.  
  30.     f = fd;
  31.     if (f < 0 && f >= -3)
  32.         return Bconin(f+3);
  33.     return Bconin(2);
  34. }
  35.  
  36. void
  37. _console_write_byte(fd, outc)
  38.     int fd, outc;
  39. {
  40.     unsigned char c;
  41.  
  42.     c = outc;
  43.     (void)Fwrite(fd, 1L, &c);
  44. }
  45.